package com.itheima.devops.writeQueue;

import org.omg.PortableInterceptor.INACTIVE;

import java.util.List;
import java.util.Random;

public class QueueManagerExample {
    public static void main(String[] args) throws InterruptedException {
        // 创建队列管理器：每个桶最多100条数据，每5秒刷新一次
        QueueManager<String> queueManager = new QueueManager<>(100, 10000);

        // 生产者线程
        new Thread(() -> {
            for (int i = 0; i < 1000; i++) {
                System.out.println("开始写入数据是否流畅："+i);
                queueManager.addData("Message-" + i);
                try {
                    Thread.sleep(new Random().nextInt(100));
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("结束写入数据是否流畅："+i);
            }
        }).start();

    }
}
